<?php
/**
 * Created by PhpStorm.
 * User: 86159
 * Date: 2020/12/26
 * Time: 20:19
 */

namespace App\Admin\Renderable;
use App\Models\User;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;


class Players extends LazyRenderable
{

    public function grid(): Grid
    {
        return Grid::make(new User(), function (Grid $grid) {
            $grid->model()->where('team_id',$this->payload['key']);
            $grid->column('user_name','用户姓名');
            $grid->column('period','剩余课时');
            $grid->column('class_end_time','课程结束时间')->display(function ($value){
                return date('Y-m-d H:i:s',$value);
            });
            $grid->paginate(20);
            $grid->disableActions();
        });
    }
}